<?php
/**
 * Controller pre debug udaje
 * @author Tomas Srna
 * @package bakalarka
 */

class DebugController extends Controller
{
	/**
	 * Zakazme v nedebugovacom mode
	 */	
	public function preDispatch()
	{
		if(!DEBUG || !Acl::instance()->allowed('debug'))
			throw new PermissionDeniedException
				('L::noDebug', "DebugController");
	}
	
	/**
	 * Akcia index
	 */
	function index()
	{
		$t = Template::instance();
		$t->title = L::selected()->debug;
		$t->text =	"\$_ENV = " . print_r($_ENV, true) .
					"\$_POST = " . print_r($_POST, true) .
					"\$_GET = " . print_r($_GET, true) . 
					"\$_COOKIE = " . print_r($_COOKIE, true) .
					"\$_SESSION = " . (isset($_SESSION) ?
						 print_r($_SESSION, true) : "undefined\n") .
					"\$_SERVER = " . print_r($_SERVER, true);
		
		$t->render('debug');
	}
}
